﻿; (function (window, undefined, $) {
    $(document).ready(function () {
        var gridopt = {
            url: options.listUrl,
            colModel: [
                    { display: 'Id', name: 'Id', width: "5%", sortable: true, hide: true, align: 'left', iskey: true },
                    { display: '会员编号', name: 'MemberId', width: "10%", sortable: true, align: 'left' },
                    { display: '公司名称', name: 'CompanyName', width: "10%", sortable: false, align: 'left' },
                    { display: '地址', name: 'Adress', width: "10%", sortable: false, align: 'left' },
                    { display: '盛付通账号名', name: 'SftUserName', width: "10%", sortable: false, align: 'left' },
                    { display: '操作', name: 'Id', width: "10%", sortable: false, align: 'center', process: processOp }
            ],
            sortname: "ID",
            sortorder: "ASC",
            title: false,
            rp: 3,
            usepager: true,
            showcheckbox: false
        };
        var xjgrid = new xjGrid("gridlist", gridopt);
        function processOp(value, cell) {
            var ops = [];
            ops.push("&nbsp;<a title='选择' href='javascript:;'  onclick=\"util.Select('", value, "','", cell[2], "','",cell[4],"')\"><i class='fa fa-edit' ></i>选择</a>");
            return ops.join("");
        }

        $("#formQuery").submit(function () {
            xjgrid.Query(this);
            return false;
        });
        $("#btnSearch").click(function () {
            $("#formQuery").submit();
        });
        $("#btnAdd").click(function (e) {
            var url = options.editUrl;
            parent.location.href = url;
        });

        util.Select = function (id, name, name2) {
            parent.document.getElementById("hideEName").value = name;
            parent.document.getElementById("Eid").value = id;
            parent.document.getElementById("LoanUser").value = name2;
            parent.document.getElementById("RepaymentUser").value = name2;
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        };
    });

})(window, undefined, jQuery);